// 引入api 获取用户信息
import { getUserinfo } from "@/api/index";

const state = {
  userinfo: {} //个人信息数据
}
const mutations = {
  GETUSERINFO(state, data) {
    state.userinfo = data
  }
}
const actions = {
  // 发送获取基本信息的请求
  // 注意；vuex中的this指向是store仓库，而不是vue原型
  async getuserinfo({ commit }) {
    let result = await getUserinfo()
    if (result.code === 200) {
      commit('GETUSERINFO', result.data)
    }
  }
}
const getters = {}
export default {
  state,
  mutations,
  actions,
  getters
}